<?php
	$pPageIsPublic = true;
	include '../_common.php';
	
	$objPage = null;
	$objImage = new File();

if (!empty($_FILES)) {
	if ($_REQUEST["action"]=='rest') {
		$objPage = new Restaurant();
		$objPage ->setUid(intval($_REQUEST["id"]));
		if (! $objPage ->load()) {
			return;
		} else {
		
			$objImage ->uploadFile('Filedata');
			$fileName = str_replace(' ', '_', $_FILES['Filedata']['name']);
			$fileName = substr($fileName, 0, strrpos($fileName, '.'));
				
			$objImage -> titulo    = $fileName ;
			$objImage -> estado   = LBN_ADMIN_STATUS_ON;
			$objImage -> restaurant->id = $objPage->id;
			$objImage -> add();
		}
	}
	
	echo "1";
}
?>